<?php

/** @var \Laravel\Lumen\Routing\Router $router */

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});



# ----------------后台相关路由----------------------
//后台认证路由
$router->group(['namespace' => 'Admin','prefix' => 'admin','middleware' => [/*'auth',*/'adminCheckPermission', 'adminOperateLog'],], function () use ($router){
    //登录请求
    $router->post('login/account', ['uses' => 'AccountController@login','as' => 'admin.login.account']);
    //退出登录
    $router->post('login/logout', ['uses' => 'AccountController@logout','as' => 'admin.login.logout']);
    //获取用户信息
    $router->get('user/current', ['uses' => 'AccountController@getInfo','as' => 'admin.user.current']);
    //获取菜单
    $router->get('user/get-config', ['uses' => 'AccountController@getConfig','as' => 'admin.user.get-config']);
    //保存账号设置
    $router->post('user/update', ['uses' => 'AccountController@update','as' => 'admin.user.update']);
    //重置密码
    $router->post('user/reset-pwd', ['uses' => 'AccountController@resetPwd','as' => 'admin.user.reset-pwd']);
    //菜单分组管理
    $router->get('sys-menu-group/index', ['uses' => 'SysMenuGroupController@index','as' => 'admin.sys-menu-group.index']);
    $router->post('sys-menu-group/save', ['uses' => 'SysMenuGroupController@save','as' => 'admin.sys-menu-group.save']);
    $router->post('sys-menu-group/destroy', ['uses' => 'SysMenuGroupController@destroy','as' => 'admin.sys-menu-group.destroy']);
    //菜单管理
    $router->get('sys-menu/index', ['uses' => 'SysMenuController@index','as' => 'admin.sys-menu.index']);
    $router->post('sys-menu/save', ['uses' => 'SysMenuController@save','as' => 'admin.sys-menu.save']);
    $router->post('sys-menu/destroy', ['uses' => 'SysMenuController@destroy','as' => 'admin.sys-menu.destroy']);
    $router->post('sys-menu/set-order', ['uses' => 'SysMenuController@setOrder','as' => 'admin.sys-menu.set-order']);
    //权限管理
    $router->get('sys-permission/index', ['uses' => 'SysPermissionController@index','as' => 'admin.sys-permission.index']);
    $router->post('sys-permission/save', ['uses' => 'SysPermissionController@save','as' => 'admin.sys-permission.save']);
    $router->post('sys-permission/destroy', ['uses' => 'SysPermissionController@destroy','as' => 'admin.sys-permission.destroy']);
    $router->post('sys-permission/set-order', ['uses' => 'SysPermissionController@setOrder','as' => 'admin.sys-permission.set-order']);
    //系统角色管理
    $router->get('sys-role/index', ['uses' => 'SysRoleController@index','as' => 'admin.sys-role.index']);
    $router->post('sys-role/save', ['uses' => 'SysRoleController@save','as' => 'admin.sys-role.save']);
    $router->post('sys-role/destroy', ['uses' => 'SysRoleController@destroy','as' => 'admin.sys-role.destroy']);
    //系统用户管理
    $router->get('sys-user/index', ['uses' => 'SysUserController@index','as' => 'admin.sys-user.index']);
    $router->post('sys-user/save', ['uses' => 'SysUserController@save','as' => 'admin.sys-user.save']);
    $router->post('sys-user/disable',['uses' =>  'SysUserController@disable','as' => 'admin.sys-user.disable']);
    $router->post('sys-user/enable',['uses' =>  'SysUserController@enable','as' => 'admin.sys-user.enable']);
    //系统操作日志
    $router->get('sys-opt-log/index', ['uses' => 'SysOperationLogController@index','as' => 'admin.sys-opt-log.index']);

    //系统文件管理
    $router->get('sys-file/index', ['uses' => 'SysFileController@index','as' => 'admin.sys-file.index']);
    //省市区列表
    $router->get('geographic/get-list', ['uses' => 'GeographicController@getList','as' => 'admin.geographic.get-list']);
});
